<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/static/lib/layuiadmin/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/lib/layuiadmin/css/global.css" media="all">
    <link rel="stylesheet" href="/static/lib/layuiadmin/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/lib/layuiadmin/css/table.css" />
</head>

<body>
<div class="admin-main">


    <div style="margin: 15px;">
        <form class="layui-form" method="post" action="/admin/banner/update">

            <blockquote class="layui-elem-quote">
                首页banner-1
            </blockquote>

            <div class="layui-form-item">
                <label class="layui-form-label">banner</label>
                <div class="layui-input-block">
                    <img <{if condition="(isset($configs['index_banner_1']))"}>src="<{$configs.index_banner_1.cvalue}>"<{/if}> style="width:200px;height:100px;" id="index_banner_1_show"/>
                    <div style="color:red;">建议大小：1920*985</div>
                    <div style="margin-top: 10px;"><input type="file" data-id="index_banner_1" name="file" class="layui-upload-file"></div>
                    <input type="hidden" <{if condition="(isset($configs['index_banner_1']))"}>value="<{$configs.index_banner_1.cvalue}>"<{/if}> id="index_banner_1"  name="index_banner_1"/>
                </div>
            </div>




            <blockquote class="layui-elem-quote">
                首页banner-2
            </blockquote>


            <div class="layui-form-item">
                <label class="layui-form-label">banner</label>
                <div class="layui-input-block">
                    <img <{if condition="(isset($configs['index_banner_2']))"}>src="<{$configs.index_banner_2.cvalue}>"<{/if}> style="width:200px;height:100px;" id="index_banner_2_show"/>
                    <div style="color:red;">建议大小：1920*985</div>
                    <div style="margin-top: 10px;"><input type="file" data-id="index_banner_2" name="file" class="layui-upload-file"></div>
                    <input type="hidden" <{if condition="(isset($configs['index_banner_2']))"}>value="<{$configs.index_banner_2.cvalue}>"<{/if}> id="index_banner_2"  name="index_banner_2"/>
                </div>
            </div>


            <blockquote class="layui-elem-quote">
                首页banner-3
            </blockquote>


            <div class="layui-form-item">
                <label class="layui-form-label">banner</label>
                <div class="layui-input-block">
                    <img <{if condition="(isset($configs['index_banner_3']))"}>src="<{$configs.index_banner_3.cvalue}>"<{/if}> style="width:200px;height:100px;" id="index_banner_3_show"/>
                    <div style="color:red;">建议大小：1920*985</div>
                    <div style="margin-top: 10px;"><input type="file" data-id="index_banner_3" name="file" class="layui-upload-file"></div>
                    <input type="hidden" <{if condition="(isset($configs['index_banner_3']))"}>value="<{$configs.index_banner_3.cvalue}>"<{/if}> id="index_banner_3"  name="index_banner_3"/>
                </div>
            </div>


            <blockquote class="layui-elem-quote">
                首页banner-4
            </blockquote>



            <div class="layui-form-item">
                <label class="layui-form-label">banner</label>
                <div class="layui-input-block">
                    <img <{if condition="(isset($configs['index_banner_4']))"}>src="<{$configs.index_banner_4.cvalue}>"<{/if}> style="width:200px;height:100px;" id="index_banner_4_show"/>
                    <div style="color:red;">建议大小：1920*985</div>
                    <div style="margin-top: 10px;"><input type="file" data-id="index_banner_4" name="file" class="layui-upload-file"></div>
                    <input type="hidden" <{if condition="(isset($configs['index_banner_4']))"}>value="<{$configs.index_banner_4.cvalue}>"<{/if}> id="index_banner_4"  name="index_banner_4"/>
                </div>
            </div>



            <blockquote class="layui-elem-quote">
                首页banner-5
            </blockquote>


            <div class="layui-form-item">
                <label class="layui-form-label">banner</label>
                <div class="layui-input-block">
                    <img <{if condition="(isset($configs['index_banner_5']))"}>src="<{$configs.index_banner_5.cvalue}>"<{/if}> style="width:200px;height:100px;" id="index_banner_5_show"/>
                    <div style="color:red;">建议大小：1920*985</div>
                    <div style="margin-top: 10px;"><input type="file" data-id="index_banner_5" name="file" class="layui-upload-file"></div>
                    <input type="hidden" <{if condition="(isset($configs['index_banner_5']))"}>value="<{$configs.index_banner_5.cvalue}>"<{/if}> id="index_banner_5"  name="index_banner_5"/>
                </div>
            </div>




            <blockquote class="layui-elem-quote">
                首页banner-6
            </blockquote>


            <div class="layui-form-item">
                <label class="layui-form-label">banner</label>
                <div class="layui-input-block">
                    <img <{if condition="(isset($configs['index_banner_6']))"}>src="<{$configs.index_banner_6.cvalue}>"<{/if}> style="width:200px;height:100px;" id="index_banner_6_show"/>
                    <div style="color:red;">建议大小：1920*985</div>
                    <div style="margin-top: 10px;"><input type="file" data-id="index_banner_6" name="file" class="layui-upload-file"></div>
                    <input type="hidden" <{if condition="(isset($configs['index_banner_6']))"}>value="<{$configs.index_banner_6.cvalue}>"<{/if}> id="index_banner_6"  name="index_banner_6"/>
                </div>
            </div>


            <blockquote class="layui-elem-quote">
                首页banner-7
            </blockquote>

            <div class="layui-form-item">
                <label class="layui-form-label">banner</label>
                <div class="layui-input-block">
                    <img <{if condition="(isset($configs['index_banner_7']))"}>src="<{$configs.index_banner_7.cvalue}>"<{/if}> style="width:200px;height:100px;" id="index_banner_7_show"/>
                    <div style="color:red;">建议大小：1920*985</div>
                    <div style="margin-top: 10px;"><input type="file" data-id="index_banner_7" name="file" class="layui-upload-file"></div>
                    <input type="hidden" <{if condition="(isset($configs['index_banner_7']))"}>value="<{$configs.index_banner_7.cvalue}>"<{/if}> id="index_banner_7"  name="index_banner_7"/>
                </div>
            </div>



            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button lay-filter="add" lay-submit class="layui-btn">提交</button>
                </div>
            </div>
        </form>
    </div>

</div>
<script type="text/javascript" src="/static/lib/layuiadmin/plugins/layui/layui.js"></script>
<script type="text/javascript">
    layui.use('form', function(){
        var form = layui.form();
    });

    var currentUploadName = '';
    layui.use(["layer","upload"],function(){
        var $ = layui.jquery;
        layui.upload({
            url: '/admin/upload/upload',
            before:function(input){
                currentUploadName = $(input).data('id');
            },
            success: function(res){
                console.log(res); //上传成功返回值，必须为json格式
                if(1 == res.code){
                    console.log(currentUploadName);
                    $("#"+currentUploadName+"_show").attr("src",res.data.src);
                    $("#"+currentUploadName).val(res.data.src);
                }else{
                    layer.msg(res.msg);
                }
            }
        });
    });
</script>

</body>

</html>